package file;

import java.io.File;
import java.io.IOException;
import java.util.AbstractCollection;

public class DeleteFileDirDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("./demo.txt");
        if(file.exists()) {
            file.delete();
            System.out.println("删除完成");
        } else {
            file.createNewFile();
            file.delete();
            System.out.println("创建了然后把他删了");
        }

        File dir = new File("./demo");
        if(dir.exists()) {
            file.delete();
            System.out.println("删除完成");
        } else {
            file.mkdir();
            System.out.println(file.getName());
            file.delete();
            System.out.println("创建然后删了");
        }

    }
}
